<?php
function parse_effect($member)
{
	$effects = $member['multiple_effect'] ? unserialize($member['multiple_effect']) : array();
	$effects = is_array($effects) ? $effects : array();
	$prefix = $suffix = "";
	foreach($effects as $type => $effect)
	{
		if($type == 'bold')
		{
			$prefix .= "<b>";
			$suffix = "</b>".$suffix;
		}
		elseif($type == 'italics')
		{
			$prefix .= "<i>";
			$suffix = "</i>".$suffix;
		}
		elseif($type == 'color')
		{
			$prefix .= "<span style=\"color:{$effect['color']}\">";
			$suffix = "</span>".$suffix;
		}
		elseif($type == 'background')
		{
			$prefix .= "<span style=\"background-color:{$effect['color']}\">";
			$suffix = "</span>".$suffix;
		}
		elseif($type == 'dropshadow')
		{
			$prefix .= "<div style=\"width:100%; filter:dropshadow(color='{$effect['color']}', offx={$effect['offx']}, offy={$effect['offy']}, Positive=".($effect['drop_background'] ? 'true' : 'false').")\">";
			$suffix = "</div>".$suffix;
		}
		elseif($type == 'shadow')
		{
			$prefix .= "<div style=\"width:100%; filter:shadow(color='{$effect['color']}', direction={$effect['direction']})\">";
			$suffix = "</div>".$suffix;
		}
		elseif($type == 'glow')
		{
			$prefix .= "<div style=\"width:100%; filter:glow(color='{$effect['color']}', strength={$effect['strength']})\">";
			$suffix = "</div>".$suffix;
		}
		elseif($type == 'blur')
		{
			$prefix .= "<div style=\"width:100%; filter:blur(add=".($effect['show_text'] ? 'true' : 'false').", direction={$effect['direction']}, strength={$effect['strength']})\">";
			$suffix = "</div>".$suffix;
		}
		elseif($type == 'flipv')
		{
			$prefix .= "<div style=\"width:100%; filter:flipv\">";
			$suffix = "</div>".$suffix;
		}
		elseif($type == 'fliph')
		{
			$prefix .= "<div style=\"width:100%; filter:fliph\">";
			$suffix = "</div>".$suffix;
		}
		elseif($type == 'wave')
		{
			$prefix .= "<div style=\"width:100%; filter:wave(strength={$effect['strength']})\">";
			$suffix = "</div>".$suffix;
		}
		elseif($type == 'xray')
		{
			$prefix .= "<div style=\"width:100%; filter:xray\">";
			$suffix = "</div>".$suffix;
		}
		elseif($type == 'invert')
		{
			$prefix .= "<div style=\"width:100%; filter:invert\">";
			$suffix = "</div>".$suffix;
		}
	}
	
	return array($prefix,$suffix);
}
?>